package springTests;

import com.guahao.im.user.service.share.service.IMUserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

/**
 * Created by kai on 2015/8/8 0008.
 */
public class SpringLoad {
    public static void main(String[] args) {
//        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//        IMUserService service = beanFactory.getBean(IMUserService.class);
        Object imUserService = ctx.getBean("imUserService");
        System.out.println(imUserService.toString());
    }

    public <T extends Animal> T findAnimal(Class<T> type) {
        return (T)new Person();
    }

    public <T extends Animal> void getaPerson(Class<T> type) {
        T t=null;
        t = findAnimal(null);
    }
}
